using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class WaybillMap : EntityTypeConfiguration<Waybill>
	{
		public WaybillMap()
		{
			// Primary Key
			this.HasKey(t => t.WaybillNO);

			// Properties
			this.Property(t => t.Status)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.WaybillType)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.WarehouseId)
				.HasMaxLength(20);
				
			this.Property(t => t.Tips)
				.HasMaxLength(200);
				
			this.Property(t => t.CustomerCode)
				.HasMaxLength(20);
				
			this.Property(t => t.CustomerOrder)
				.HasMaxLength(50);
				
			this.Property(t => t.CustomerBatchNO)
				.HasMaxLength(20);
				
			this.Property(t => t.TransferID)
				.IsFixedLength()
				.HasMaxLength(2);
				
			this.Property(t => t.PaymentTypeID)
				.IsFixedLength()
				.HasMaxLength(2);
				
			this.Property(t => t.PerFormCode)
				.HasMaxLength(20);
				
			this.Property(t => t.LineCode)
				.HasMaxLength(20);
				
			// Table & Column Mappings
			this.ToTable("Waybill");
			this.Property(t => t.WaybillNO).HasColumnName("WaybillNO");
			this.Property(t => t.Status).HasColumnName("Status");
			this.Property(t => t.WaybillType).HasColumnName("WaybillType");
			this.Property(t => t.Sources).HasColumnName("Sources");
			this.Property(t => t.WarehouseId).HasColumnName("WarehouseId");
			this.Property(t => t.Tips).HasColumnName("Tips");
			this.Property(t => t.IsFeedback).HasColumnName("IsFeedback");
			this.Property(t => t.Autodeliever).HasColumnName("Autodeliever");
			this.Property(t => t.CustomerCode).HasColumnName("CustomerCode");
			this.Property(t => t.CustomerOrder).HasColumnName("CustomerOrder");
			this.Property(t => t.CustomerBatchNO).HasColumnName("CustomerBatchNO");
			this.Property(t => t.IsGetGoods).HasColumnName("IsGetGoods");
			this.Property(t => t.IsAuthorized).HasColumnName("IsAuthorized");
			this.Property(t => t.AbnormalStaus).HasColumnName("AbnormalStaus");
			this.Property(t => t.DeliverStationID).HasColumnName("DeliverStationID");
			this.Property(t => t.DeliverManID).HasColumnName("DeliverManID");
			this.Property(t => t.TurnstationId).HasColumnName("TurnstationId");
			this.Property(t => t.WaybillIntoStationID).HasColumnName("WaybillIntoStationID");
			this.Property(t => t.WaybillDealID).HasColumnName("WaybillDealID");
			this.Property(t => t.CreatBy).HasColumnName("CreatBy");
			this.Property(t => t.CreatStation).HasColumnName("CreatStation");
			this.Property(t => t.CreatTime).HasColumnName("CreatTime");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateStation).HasColumnName("UpdateStation");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.IsDelete).HasColumnName("IsDelete");
			this.Property(t => t.SynTime).HasColumnName("SynTime");
			this.Property(t => t.IsPrinted).HasColumnName("IsPrinted");
			this.Property(t => t.TransferID).HasColumnName("TransferID");
			this.Property(t => t.PaymentTypeID).HasColumnName("PaymentTypeID");
			this.Property(t => t.AssignTime).HasColumnName("AssignTime");
			this.Property(t => t.IsSyn).HasColumnName("IsSyn");
			this.Property(t => t.BatchCreatTime).HasColumnName("BatchCreatTime");
			this.Property(t => t.BackStatus).HasColumnName("BackStatus");
			this.Property(t => t.GisStatus).HasColumnName("GisStatus");
			this.Property(t => t.PerFormCode).HasColumnName("PerFormCode");
			this.Property(t => t.MerchantID).HasColumnName("MerchantID");
			this.Property(t => t.LineID).HasColumnName("LineID");
			this.Property(t => t.LineCode).HasColumnName("LineCode");
		}
	}
}

